package com.ray.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ray.service.DuplicateOrderUpdateRecordsService;
import com.ray.util.RequestUtil;
import com.ray.util.ResponseUtil;

/**
 * 投料单修改订单物料信息备份记录控制层
 * @author libin
 *
 */
@Controller
@RequestMapping("/duplicateOrderUpdateRecords")
public class DuplicateOrderUpdateRecordsContorller {
	
	@Autowired
	DuplicateOrderUpdateRecordsService  duplicateOrderUpdateRecordsService;
	
	@RequestMapping("/getDuplicateOrderUpdateRecordsListByIds")
	@ResponseBody
	public Map<String,Object> getDuplicateOrderUpdateRecordsListByIds(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(duplicateOrderUpdateRecordsService.getDuplicateOrderUpdateRecordsListByIds(map));
	}
	
	@RequestMapping("/getDuplicateOrderUpdateRecordsList")
	@ResponseBody
	public Map<String,Object> getDuplicateOrderUpdateRecordsListPage(HttpServletRequest request){
		Map<String,Object> map = RequestUtil.getRequestAllParam(request);
		return ResponseUtil.ResponseResult(duplicateOrderUpdateRecordsService.getDuplicateOrderUpdateRecordsListPage(map));
	}
	
	@RequestMapping("/approvalDuplicateOrder")
	@ResponseBody
	public Map<String,String> approvalDuplicateOrder(HttpServletRequest request){
		Map<String,String> map = RequestUtil.getRequestAllParam(request);
		duplicateOrderUpdateRecordsService.changeIsApprovalById(map);
		return ResponseUtil.ResponseResult("审核成功");
	} 
	
	@RequestMapping("/deleteDuplicateOrder")
	@ResponseBody
	public Map<String,Object> deleteDuplicateOrder(HttpServletRequest request){
		Map<String,String> map = RequestUtil.getRequestAllParam(request);
		duplicateOrderUpdateRecordsService.deleteDuplicateOrder(map);
		return ResponseUtil.ResponseResult("退回成功");
	}
	
}
